package com.tdt.alarm.model;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

import com.tdt.alarm.DateTimeAdapter;
import com.tdt.alarm.R;

public class DateTime extends Activity {

	String[] items = {"Automatic date & time", "Set date", "Set time", "Set time zone", "Use 24-hour format", "Choose date format"};
	ListView listViewDateTime;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_date_time);
		listViewDateTime = (ListView)findViewById(R.id.listViewDateTime);
		
		DateTimeAdapter adapter = new DateTimeAdapter(this, R.layout.row_one, items);
		listViewDateTime.setAdapter(adapter);
		listViewDateTime.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				Toast.makeText(DateTime.this, "abc", Toast.LENGTH_SHORT).show();
				System.out
						.println("List4.onCreate(...).new OnItemClickListener() {...}.onItemClick()");
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.date_time, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}
